package com.example.smart.room.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import com.example.smart.room.bean.ReservationBean
import com.example.smart.room.constants.SqlConstant

@Dao
interface ReservationDAO {

    @Query("select * from ${SqlConstant.RESERVATION} where date =:date")
    suspend fun checkIsExists(date: String): MutableList<ReservationBean>

    @Insert
    suspend fun insert(bean: ReservationBean)

    @Query("update ${SqlConstant.RESERVATION} set time =:time where date =:date")
    suspend fun update(date: String, time: String)

    @Query("select * from ${SqlConstant.RESERVATION} order by id desc")
    suspend fun getAllData(): MutableList<ReservationBean>
}